package c1764;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class G {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int T = cin.nextInt();
        while (T-- > 0) {
            int n = cin.nextInt();
            Set<Integer> set = new HashSet<Integer>();
            while (n-- > 0) {
                set.add(cin.nextInt());
            }
            System.out.println(set.size());
        }
        cin.close();
    }
}